package ar.edu.unq.wannaplay.panels.project;

import java.util.List;

import ar.edu.unq.wannaplay.dtos.SkillDTO;
import ar.edu.unq.wannaplay.pages.project.EditProjectPage;
import ar.edu.unq.wannaplay.panels.AbstractEditModelObjectSkillsPanel;
import ar.edu.unq.wannaplay.services.ProjectService;
import ar.edu.unq.wannaplay.utils.ProjectEditer;

public class EditProjectSkillsPanel extends AbstractEditModelObjectSkillsPanel<ProjectEditer, ProjectService> {

    private static final long serialVersionUID = 1L;

    public EditProjectSkillsPanel(final String id, final ProjectEditer modelObject, final ProjectService aService) {
        super(id, modelObject, aService);
    }

    @Override
    protected List<SkillDTO> getModelObjectSkills() {
        return this.getModelObject().getSkilsDTO();
    }

    @Override
    protected void onAcceptAction() {
        this.getModelObject().setSkillsDTO(this.getSkillsList());
        this.getService().updateProjectSkills(this.getModelObject().getId(), this.getSkillsList());

    }

    @Override
    protected void setResponsePageAbs() {
        this.setResponsePage(new EditProjectPage(this.getModelObject(), this.getService()));
    }
}
